package com.lggry.array.helloWorld;

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println(getCode());
        System.out.println(sum(1, 2));
    }

    //定义一个方法，生成随机4位数字验证码并返回
    public static String getCode() {
        String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 4; i++) {
            int index = (int) (Math.random() * str.length());
            char c = str.charAt(index);
            sb.append(c);
        }
        return sb.toString();
    }

    //定义一个方法，求两个数之和
    public static int sum(int a, int b) {
        return a + b;
    }


}









